<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="__PUBLIC__/echarts/echarts.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all">
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    <script src="{$Think.config.httpFlag}{$Think.config.google_map_url}" async="async"></script>
</head>

<body>
<div class="layui-fluid main">

    <div style="display: inline-block;width: 100%">
        <fieldset class="layui-elem-field site-demo-button" style="margin-top:20px;border:0">
            <h2><strong>{if !empty($name)}{$name}{/if}</strong></h2>
        </fieldset>
        <fieldset class="layui-elem-field site-demo-button" style="margin-top: 30px;border:0">

            <form class="layui-form serch" action="/admin/poi/teamlist/id/{$id}.shtml" method="post">
                <div class="layui-form-item" style="float: left;">
                    <div class="layui-input-inline">
                        <input type="text" name="cityname" lay-verify="title" autocomplete="off" placeholder="请输入名称" class="layui-input layui-btn-sm">
                    </div>
                    <div class="layui-input-inline">
                        <input type="text" name="source" lay-verify="title" autocomplete="off" placeholder="请输入来源" class="layui-input layui-btn-sm">
                    </div>
                    <button class="layui-btn layui-btn-danger layui-btn-sm" lay-submit="" lay-filter="serch">搜索</button>
                    <a href="{:url('admin/poi/addteam',['groupid'=>$id])}" class="layui-btn layui-btn-sm a_menu">
                        新增供应商
                    </a>
                    <a href="{:url('admin/poi/team')}" class="layui-btn layui-btn-sm">
                        返回列表
                    </a>
                </div>
            </form>
        </fieldset>
        <table class="layui-table"  lay-even="" lay-skin="line" >
            <colgroup>
                <col width="100">
                <col width="300">
                <col width="300">
                <col width="300">
                <col width="200">
            </colgroup>
            <thead>
            <tr>
                <th>ID</th>
                <th>供应商名称</th>
                <th>来源</th>
                <th>更新时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            {volist name="poi" id="vo"}
            <tr class="seemap" codeid="{$vo.id}">
                <td>{$vo.id}</td>
                <td ><strong>{$vo.name}</strong><br/>{$vo.eng_name}</td>
                <td >{$vo.source}</td>
                <td>{$vo.update_time}</td>
                <td class="operation-menu">
                    <a href="{:url('admin/poi/seeteam',['id'=>$vo.id])}" class="layui-btn layui-btn-xs a_menu" style="margin-left: 0;font-size:12px;">预览</a>
                    <a href="{:url('admin/poi/addteam',['id'=>$vo.id])}" class="layui-btn layui-btn-xs a_menu" style="margin-left: 0;font-size:12px;">修改</a>
                    <a class="layui-btn layui-btn-xs layui-btn-danger delete" data-id="{$vo.id}" style="margin-left: 0;font-size:12px;">删除</a>
                    <a  class="layui-btn layui-btn-primary layui-btn-xs download" data-id="{$vo.fileid}" id="download{$vo.fileid}" style="margin-left: 0;font-size:12px;">下载文件</a>
                </td>

            </tr>
            {/volist}

            </tbody>
        </table>
    </div>

</div>
<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script type="text/javascript">
    layui.use('layer', function(){
        var layer = layui.layer;
        $('.a_menu').click(function(){
            var url = $(this).attr('href');
            var a = 0;
            $.ajax({
                url:url
                ,async:false
                ,success:function(res){
                    if(res.code == 0) {
                        layer.msg(res.msg);
                        a = 1;
                    }
                }
            })
            if(a === 0) {
                layer.open({
                    type:2,
                    content:url,
                    area: ['800px', '600px'],
                    end:function(){
                        location.reload();
                    }
                });
            }
            return false;
        })

        $('.preview').click(function(){
            var url = $(this).attr('href');
            layer.open({
                type:2,
                content:url,
                area: ['550px', '400px']
            });
            return false;
        })

    });
    $(".seemap").click(function () {
        var id = $(this).attr('codeid');
        $.ajax({
            url:"{:url('admin/poi/seepoimap')}",
            data:{id:id},
            success:function(res) {
                if(res.code == 1) {
                    var data=res.data;
                    $("#description").html(data[0].description);
                    $("#poiname").html(data[0].name);
                    $("#poieng_name").html(data[0].eng_name);
                    $("#introduce").html(data[0].introduce);
                    $("#mobile").html(data[0].mobile);
                    // initialize(data[0].lat,data[0].lng);
                }else{
                    layer.msg(res.msg);
                }
            }
        })
    })

    $('.delete').click(function(){
        var id = $(this).attr('data-id');
        layer.confirm('确定要删除?', function(index) {
            $.ajax({
                url:"{:url('admin/poi/delpoi')}",
                type:"post",
                data:{id:id},
                success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        setTimeout(function(){
                            location.href = res.url;
                        },1500)
                    }
                }
            })
        })
    })

    $('.download').on('click',function(event){
        var data_id = $(this).attr('data-id');
        var id = $(this).attr('id');
        var download = document.getElementById(id);
        $.ajax({
            url:"{:url('admin/attachment/download')}",
            data:{id:data_id},
            async:false,
            success:function(res) {
                console.log('res:'+res.code);
                if(res.code == 1) {
                    download.setAttribute('href',res.data);
                    download.setAttribute('download',res.name);
                    // download.click();

                } else {
                    layer.msg(res.msg);
                }
            }
        })
    })

</script>
<!--<script type="text/javascript">-->
    <!--//地图功能-->
    <!--var geocoder;-->
    <!--var map2;-->
    <!--var marker=new google.maps.Marker();-->
    <!--function initialize(lat,lng) {-->
        <!--geocoder = new google.maps.Geocoder();-->
        <!--var myOptions = {-->
            <!--zoom : 10,//缩放比例-->
            <!--center:new google.maps.LatLng(lat,lng),-->
            <!--mapTypeId : google.maps.MapTypeId.ROADMAP-->
        <!--};-->
        <!--map2 = new google.maps.Map(document.getElementById("map"),-->
            <!--myOptions);-->
        <!--marker.setMap(null);-->
        <!--marker = new google.maps.Marker({-->
            <!--map : map2,-->
            <!--position :new google.maps.LatLng(lat,lng),-->
            <!--//坐标动画效果-->
            <!--animation : google.maps.Animation.DROP-->
        <!--});-->
        <!--marker.setMap(map2);-->
    <!--}-->

    <!--initialize({$latlng[0]},{$latlng[1]});-->

<!--</script>-->
</body>
</html>
